		<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/mosaic.css" type="text/css" media="screen" />
		<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/mosaic.1.0.1.js"></script>
		  <script type="text/javascript">  	
			jQuery(function($){
				$('.circle').mosaic({
					opacity		:	0.8			//Opacity for overlay (0-1)
				}); 
		    });
		    
		</script>
<script>

function check()
{
	if(document.getElementById('Quiz').value == "Quiz" || document.getElementById('Quiz').value == "") 
	{
		
			ShowError("Please enter location and restaurant or cuisine!");
			return false;
	} 
	return true;
}
function ShowError(message)
{
	document.getElementById("error_message").style.display = 'block';
	document.getElementById("error_message").innerHTML = message;
	var t = setTimeout("hideErrorMessage()",4500);
}
function hideErrorMessage()
{
	document.getElementById("error_message").style.display = 'none';
	return false;
}
function clearText()
{
	
	textbox1 = document.getElementById('searchtextbox');

	
	
	if(textbox1.value == "Enter Quiz Here") 
	{
		textbox1.value = "";
	} 
	else if(textbox1.value == "") 
	{
		textbox1.value = "Enter Quiz Here";
	} 
}

</script>
<link href="<?php echo Yii::app()->request->baseUrl; ?>/css/styles.css" rel="stylesheet" media="screen"  />

<script  type="text/javascript" language="javascript">
	$(document).ready(function(){
    $('.adCntnr div.acco2:eq(0)').find('div.expand:eq(0)').addClass('').end()
    	.find('div.collapse:eq(0)').hide().end()
    .find('div.collapse:gt(0)').hide().end()
    .find('div.expand').click(function() {
        $(this).toggleClass('openAd').siblings().removeClass('openAd').end()
        .next('div.collapse').slideToggle().siblings('div.collapse:visible').slideUp();
        return false;
    });
})
</script>
<form action="<?php echo Yii::app()->baseUrl . '/index.php/test/searchResult';?>" method="get" onsubmit="return check();">

 						<div class="search_box_wrap">
	 							
		         		<?php
							$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
		     			 		'name'=>'searchtextbox',
		      			 		'id'=>'searchtextbox',
								'value'=>'Enter Quiz Here',
		      					'source'=>'js: function(request, response) {
		   						 $.ajax({
		        					url: "'.$this->createUrl('test/searchrest').'",
		        					dataType: "json",
		        					data: {
		            				term: request.term,
		        
		            				
		        					},
		        					success: function (data) {
		                			response(data);
		        						}
		    						})
		 						}',
								//$this->createUrl('search/searchloc'),
		     			 		'options'=>array(
		                  		'showAnim'=>'fold',
								'minLength'=>'2',
		                  		
								),
		                  		'htmlOptions'=>array('size'=>'40','onfocus'=>'clearText()',
									'onblur'=>'clearText()','class'=>'restaurant',),      
							 ));
						
							Yii::app()->clientScript->registerScript('custom_loc_search','	
			    			$("#searchtextbox").data( "autocomplete" )._renderItem = function( ul, item ) {

			    				
			    					return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a><h6>" + item.value + "</h6></a>" ) .appendTo(ul);
			 					
							};');
						?>
            			</div><!-- search_box_wrap -->
						<div style="height:66px;width:4% !important;margin-top: -3%;margin-left: 25%;">
	            		<input class="submit transition" type="submit" value="Go" name="search"/>
						</div>
            		</form>

<h2>Quiz Category</h2>
<div style="width:100%; margin:0 auto 0 auto;">
   
  <div class="adCntnr" >
    <div class="acco2">
<?php
$var="";

$category=Category::model()->findAll();


foreach($category as $cat)
{
?>

<?php 

$newsWhere =  "status =" . 'status' . "
AND (status LIKE '%published%')

ORDER BY id DESC;";
 //LIMIT 7
$newsModel=Quiz::model()->findAll('category_id=?',array($cat->id),$newsWhere);
if($newsModel){?>
<div class="expand"><a title="expand/collapse" href="#" style="display: block;">
        <div style="float:left; min-width:35%;"><?php echo $cat->name;?></div>
        <div style="float:left; padding-left:8px ">Details</div>
        <br clear="all" />
        </a> </div> <?php }?>
       
        <div class="collapse">
        <div class="accCntnt">
          <div class="titlebarLeftc" style="border-bottom:1px solid #dadada;">
            <div class="titlebarRightc">
              <div class="titlebar">
               
              </div>
            </div>
          </div>
           <div class="dataGrid_container">
            <table class="dataGrid" width="100%" cellpadding="0" cellspacing="0">
              <tr class="dataAlterRw1">
                <td class="dataGridHdr_boder">
        <?php 
        foreach ($newsModel as $var)
{ 
	
	$user=$var->user_id;
	//$id=Admin::model()->find("id=?",array($user));
	//$name=$id->username;	
  $disc=ApplicationConfig::truncatestring($var->description,10);
echo '<div class="quiz mosaic-block circle"><div style="margin-top:5px;margin-left:3px;">';
echo "<b style='font-weight: bolder;'>Quiz Name        :</b>          ".$var->title."<br>";
echo "<b style='font-weight: bolder;'>Description :</b>            ".$disc."<br>";
echo "<b style='font-weight: bolder;'>Author            :</b>       <br>";
echo "<b style='font-weight: bolder;'>Play Time     : </b>           ".$var->time."  Minutes<br></div>";


$this->widget('application.extensions.fancybox.EFancyBox', 
    array( 'target'=>'a#quizid', 
            'config'=>array( 
                'titleShow' => true, 
    			'height' =>'50%',
				'width'	 =>'50%',
    			'scrolling' => 'No',
            )
        )
    );



if (Yii::app()->user->isGuest) {

echo '<a id="quizid" href="'.ApplicationConfig::getURL("admin", "login", "login",array('qid'=>$var->id)).'" class="mosaic-overlay"><img src="'.Yii::app()->request->baseUrl.'/images/images.jpg"  style="height: 50px;width: 300px;margin-left: -15px;margin-top: -5px;"/></a><br/>';

}
else 
echo '<a href="'.ApplicationConfig::getURL("", "test","quiz",array('qid'=>$var->id)).'" class="mosaic-overlay"><img src="'.Yii::app()->request->baseUrl.'/images/images.jpg"  style="height: 50px;width: 300px;margin-left: -15px;margin-top: -5px;"/></a><br/>';
   echo '</div>';

}?>
</td>
              </tr>
             
            </table>
          </div>
        </div>
      </div>

<?php } ?>


<div id="sharebox"></div>
